using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Microsoft.Lync.Controls;

namespace WorkItemCollaborator
{
    public class HistoryItem : INotifyPropertyChanged
    {
        private string historyComment;
        private DateTime revisionDate;
        private User owner;
        private ConversationContextualInfo historyItemContextualInformation;

        public event PropertyChangedEventHandler PropertyChanged;

        #region Properties Getters and Setters
        
        public string HistoryComment
        {
            get { return this.historyComment; }
            set
            {
                this.historyComment = value;
                OnPropertyChanged("HistoryComment");
            }
        }

        public DateTime RevsionDate
        {
            get { return this.revisionDate; }
            set
            {
                this.revisionDate = value;
                OnPropertyChanged("RevsionDate");
            }
        }
        
        public ConversationContextualInfo HistoryItemContextualInformation
        {
            get { return this.historyItemContextualInformation; }
            set
            {
                this.historyItemContextualInformation = value;
                OnPropertyChanged("HistoryItemContextualInformation");
            }
        }
        private bool isVisible;
        public bool IsVisible
        {
            get { return isVisible; }
            set
            {
                this.isVisible = value;
                OnPropertyChanged("IsVisible");
            }
        }
        public User Owner
        {
            get { return this.owner; }
            set
            {
                this.owner = value;
                OnPropertyChanged("Owner");
            }
        }

        #endregion

        public HistoryItem(string historyComment, DateTime revisionDate, User owner, ConversationContextualInfo historyContextualInformation, ObservableCollection<ChangedField> changedFields)
        {
            this.historyComment = historyComment;
            this.revisionDate = revisionDate;
            this.owner = owner;
            this.historyItemContextualInformation = historyContextualInformation;
            this.changedFields = changedFields;
            this.isVisible = true;
        }
       
        protected void OnPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

        private ObservableCollection<ChangedField> changedFields;
        public ObservableCollection<ChangedField> ChangedFields
        {
            get { return this.changedFields; }
            set
            {
                this.changedFields = value;
                OnPropertyChanged("ChangedFields");
            }
        }
     
    }
}

